{include file="public/head"/}
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header"> 订单【{$info.id}】【{$info.order_sn}】确认核销</div>
                <div class="layui-card-body" pad15>

                    <div class="layui-form" wid100 lay-filter="form">

                        <div class="layui-form-item">

                            <table class="layui-table">
                                <thead>
                                    <tr>
                                        <th>商品编号</th>
                                        <th>名称</th>
                                        <th>缩略图</th>
                                        <th>规格标识</th>
                                        <th>规格</th>
                                        <th>单价</th>
                                        <th>原价</th>
                                        <th>购买数量</th>
                                        {if $info['verify_type']==2}
                                        <th>剩余数量</th>
                                        {/if}
                                    </tr>
                                </thead>
                                <tbody>
                                    {foreach $order_goods as $og}
                                    <tr>
                                        <td>{$og.goods_id}</td>
                                        <td>{$og.title}</td>
                                        <td>
                                            <img src="{$og.thumb}" style="width:50px;height:50px;" onclick="layer.tips('<div style=\'background-color: #fff;\'><img style=\'max-width: 300px;\' src={$og.thumb}></div>',this,{tips: [1, '#fff'],time:-1,closeBtn:1,area: ['auto', 'auto']});">
                                        </td>
                                        <td>{$og.sku}</td>
                                        <td>{$og.spec_item_title}</td>
                                        <td>{$og.price}</td>
                                        <td>{$og.original_price}</td>
                                        <td>{$og.num}{$og.unit}</td>
                                        {if $info['verify_type']==2}
                                        <td>{$og.leave_num}{$og.unit}</td>
                                        {/if}
                                    </tr>
                                    {/foreach}
                                </tbody>
                            </table>

                        </div>

                        <div class="layui-form-item">
                            <div class="layui-input-inline">
                                <input type="text" name="verify_code" lay-verify="required" placeholder="请输入核销码" class="layui-input" autocomplete="off">
                            </div>
                            <div class="layui-form-mid layui-word-aux">请输入核销码</div>
                        </div>

                        {if $info['verify_type']==2}
                        <div class="layui-form-item">
                            <div class="layui-input-inline">
                                <input type="number" name="num" lay-verify="required" step="1" min="1" value="1" placeholder="请输入核销次数" class="layui-input" autocomplete="off">
                            </div>
                            <div class="layui-form-mid layui-word-aux">核销次数最少一次</div>
                        </div>
                        {/if}

                        <div class="layui-form-item">
                            <input type="hidden" name="id">
                            <button class="layui-btn" lay-submit lay-filter="edit-btn">{:get_goods_verify_type(3,$info['verify_type'])}</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/foot"/}
<script>
    layui.config({
        base: '__LAYADMIN__/',
        version: 20220407
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index','form','laydate'],function(){
        var $=layui.$,admin=layui.admin,form = layui.form,laydate=layui.laydate;
        form.val("form", {$info|raw});
        //提交
        form.on('submit(edit-btn)', function (data) {
            layer.confirm('确定进行核销吗？', function(){
                layer.closeAll('dialog');
                admin.req({
                    url: '{:url(\'Order/doVerify\')}' //实际使用请改成服务端真实接口
                    , type: 'post'
                    , data: data.field
                    , done: function (res) {
                        layer.msg(res.msg, {icon: 1, time: 1000}, function () {
                            parent.layer.closeAll("iframe");
                            //刷新父页面
                            parent.tableIn.reload();
                        });
                    }
                });
            });

        });

    });
</script>
</body>
</html>